tests.list = function(){

    var testsWithErrors = [];
  
    var actualError = null;

    var gridComplete = function() {
        var run;
        var id;
        var gc = function() {
            if(run && id) {
                tests.list.select({
                    id:id
                });
                tests.list.scrollTo({
                    id:id
                });
            }
            run = false;
            jQuery('#list').setGridParam({datatype:'json'});
        }
        gc.setId = function (newId) {
            id = newId;
            run = true;
        }
        return gc;
    }();
    
    return {
        gridComplete : gridComplete,
        scrollTo : function(json) {
            $('.grid_bdiv').scrollTo($("tr#" + json.id),300);
        },
        select : function(json) {
            jQuery("#list").setSelection(json.id);
        },
        highlight : function(id) {
            $('tr#'+id).effect("highlight", {}, 5000);
        },
        refresh : function(json) {
            jQuery('#list').setGridParam({datatype:'json'}).trigger("reloadGrid").setGridParam({datatype:'local'});
            if(json != undefined && json.id != undefined) {
                tests.list.gridComplete.setId(json.id);
            }
            jQuery("#list").trigger("reloadGrid");
        },
        display : function(json) {
            $('#test-list').html(json.data);
        }
    };
}();
